<?php

require_once dirname(__FILE__).'/../lib/vendor/symfony/lib/autoload/sfCoreAutoload.class.php';
sfCoreAutoload::register();

class ProjectConfiguration extends sfProjectConfiguration
{

  public function setup()
  {
    //On configure automatiquement vers le dossier
    if(is_dir($this->getRootDir().'/web-mg'))
        $this->setWebDir($this->getRootDir().'/web-mg');
    

    $this->dispatcher->connect('request.filter_parameters', array($this, 'filterRequestParameters'));
    $this->dispatcher->connect('view.configure_format', array($this, 'configureIPhoneFormat'));

    $this->enablePlugins('sfDoctrinePlugin');
    $this->enablePlugins('sfDoctrineGuardPlugin');

    $this->enablePlugins('sfFormExtraPlugin');
    $this->enablePlugins('sfOrmBreadcrumbsPlugin');
    $this->enablePlugins('sfEmailManagerPlugin');

    $this->enablePlugins('icfbAutocompletePlugin');
    $this->enablePlugins('sfDoctrineOAuthPlugin');
  }
  //Sert à configurer la prise en charge Mobile de KTD
  public function filterRequestParameters(sfEvent $event, $parameters){
      $request = $event->getSubject();
      /*if(preg_match("#Mobile/.+Safari#i", $request->getHttpHeader('User-Agent')))
              $request->setRequestFormat('iphone');
       */
      return $parameters;
  }

  public function configureIPhoneFormat(sfEvent $event)
  {
    if ('iphone' == $event['format'])
    {
       
    }
  }

}
